﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="TaskList.aspx.cs" Inherits="BSCMFF.Web.Pages.TaskList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
    
        <telerik:RadGrid ID="RadGrid1" runat="server" 
            DataSourceID="EntityDataSourceTasks" AllowAutomaticDeletes="True" 
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True" 
            AllowSorting="True" AutoGenerateEditColumn="True" GridLines="None" 
            oninsertcommand="RadGrid1_InsertCommand" AutoGenerateDeleteColumn="True" 
            ondeletecommand="RadGrid1_DeleteCommand">
            <MasterTableView DataSourceID="EntityDataSourceTasks" CommandItemDisplay="Bottom" 
                AutoGenerateColumns="False" DataKeyNames="Task_ID">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="Task_ID" DataType="System.Int32" 
                        HeaderText="Task_ID" ReadOnly="True" SortExpression="Task_ID" 
                        UniqueName="Task_ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" 
                        SortExpression="Name" UniqueName="Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Description" HeaderText="Description" 
                        SortExpression="Description" UniqueName="Description">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Date_Assigned" DataType="System.DateTime" 
                        HeaderText="Date_Assigned" SortExpression="Date_Assigned" 
                        UniqueName="Date_Assigned">
                    </telerik:GridBoundColumn>
                
                    <telerik:GridBoundColumn DataField="Date_EndExpected" HeaderText="Date_EndExpected" 
                        SortExpression="Date_EndExpected" UniqueName="Date_EndExpected" 
                        DataType="System.DateTime">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Date_Completed" 
                        HeaderText="Date_Completed" SortExpression="Date_Completed" 
                        UniqueName="Date_Completed">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Priority" 
                        DataType="System.Int32" HeaderText="Priority" 
                        SortExpression="Priority" UniqueName="Priority">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Weight" DataType="System.Int32" 
                        HeaderText="Weight" SortExpression="Weight" UniqueName="Weight">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="User_FK" DataType="System.Int32" 
                        HeaderText="User_FK" SortExpression="User_FK" UniqueName="User_FK">
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings EditFormType="WebUserControl" UserControlName="~/UserControls/Details/TaskDetails.ascx" >
                </EditFormSettings>
                
                    <%--<EditFormSettings EditFormType="Template" EditColumn-UniqueName="TaskDetails">
                    <EditColumn UniqueName="TaskDetails"></EditColumn>
                    <FormTemplate>
                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelName" runat="server" Text="Name"  />
                                </td>
                                <td>
                                    <telerik:RadTextBox ID="TextBoxName" runat="server" MaxLength="100" Text='<%# Bind( "Name") %>'>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelDescription" runat="server" Text="Description" />
                                </td>
                                <td>
                                    <telerik:RadTextBox ID="TextBoxDescription" runat="server" TextMode="MultiLine" Text='<%# Bind("Description") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelWeight" runat="server" Text="Weight" />
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox ID="NumericTextBoxWeight" runat="server" ShowSpinButtons="true"  
                                         Value="0" Width="60px" MinValue="0" MaxValue="100" Type="Percent" Text='<%# Bind( "Weight") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label1" runat="server" Text="Priority" />
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox ID="NumericTextBoxPriority" runat="server" ShowSpinButtons="true"  
                                         Value="0" Width="60px" MinValue="1" MaxValue="10" Text='<%# Bind( "Priority") %>'>
                                         <NumberFormat DecimalDigits="0"  />
                                         </telerik:RadNumericTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelAssigned" runat="server" Text="Assigned" />
                                </td>
                                <td>                                
                                    <telerik:RadDatePicker ID="RadDatePickerAssigned" runat="server" DbSelectedDate='<%# Bind( "Date_Assigned") %>'
                                                    Skin="Vista" Culture="sk-SK"  >
                                    </telerik:RadDatePicker>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelEndExpeted" runat="server" Text="Expected" />
                                </td>
                                <td>                                
                                    <telerik:RadDatePicker ID="RadDatePickerEndExpeted" runat="server" DbSelectedDate='<%# Bind( "Date_EndExpected") %>'
                                                    Skin="Vista">
                                    </telerik:RadDatePicker>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelCompleted" runat="server" Text="Completed" />
                                </td>
                                <td>                                
                                    <telerik:RadDatePicker ID="RadDatePickerCompleted" runat="server" DbSelectedDate='<%# Bind( "Date_Completed") %>'
                                                    Skin="Vista" Enabled="false">
                                    </telerik:RadDatePicker>
                                </td>
                            </tr>
                        </table>

                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelUser" runat="server" Text="Employer" />
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropDownListUsers" runat="server" SelectedValue='<%# Bind("User_FK") %>' 
                                            DataSourceID="EntityDataSourceUsers" DataValueField="User_ID"
                                                        DataTextField="Login" AppendDataBoundItems="true"
                                            Style="z-index: 1;">
                                            <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
                                        </asp:DropDownList>
                                </td>
                            </tr>
                        </table>

                        <table style="width: 100%">
                            <tr>
                                <td align="right">
                                    <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button>&nbsp;
                                    <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                    </asp:Button>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>--%>
            </MasterTableView>
        
            <HeaderContextMenu EnableAutoScroll="True">
            </HeaderContextMenu>
        </telerik:RadGrid>

        <asp:Label id="l" runat="server" Text="nothing" ></asp:Label>
    </telerik:RadAjaxPanel>

    <asp:EntityDataSource ID="EntityDataSourceTasks" runat="server" 
        ConnectionString="name=BSCEntities" DefaultContainerName="BSCEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="Tasks">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EntityDataSourceUsers" runat="server" 
        ConnectionString="name=BSCEntities" DefaultContainerName="BSCEntities" 
        EnableFlattening="False" EntitySetName="Users" Include="Contact">
    </asp:EntityDataSource>

</asp:Content>
